import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String str = scan.nextLine();

        String[] strArr = str.split(" ");
        System.out.println(strArr[strArr.length-1].length());

        int index = str.lastIndexOf(" ");
        int len = str.substring(index+1).length();
        System.out.println(len);
    }
}